<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include_once(APPPATH."libraries/AdminController.php");
class Config extends AdminController {  
	
	function __construct()   
	{
		parent::__construct();   
		$this->_set_action();
		$this->_set_title('Setting > Konfigurasi');
		$this->DATA->table="macs_config";
		$this->folder_view = "ios/";
		$this->load->model("mdl_config","MC");
		$this->prefix_view = strtolower($this->_getClass());

	}

	function index(){
		$this->_set_desc_title('Konfigurasi Website');		
		$m =  $this->MC->data();
		$this->_v($this->folder_view.$this->prefix_view,array(
			'data'	=> $m['data']
		));
	}
	
	function save(){
		if(isset($_POST['submit'])){
			foreach($_POST as $k=>$v){
				if($k!='submit'){					
					$a = $this->DATA->_update(array('config_name'	=> dbClean($k)),
						array('config_value'	=> dbClean($_POST[$k]))
					);
				}
			}
			
		}
		$this->index();
	}

}
